############################################################## 
## MOD Title: YouTube Video BBCode 
## MOD Author: REEF_01 < webmaster@piratesdelcaribe.com.ar > http://www.piratesdelcaribe.com.ar/foro/index.php 
## MOD Description: Agrega un nuevo bbcode permitiendo que encaje fcilmente videos de YouTube.com 
## MOD Version: for phpbb plus 1.52
## 
## Installation Level: (Easy) 
## Installation Time: ~5 Minutes
## Files To Edit: 
##		  - includes/bbcode.php,
##                - bbcode_box/add_bbcode.js,
##                - langugage/lang_english/lang_main.php,
##                - templates/fisubsilversh/bbcode.tpl,
##                - templates/fisubsilversh/posting_body.tpl,
##
## Included Files: youtube.gif
##
##############################################################
##
## Note: Si no es un foro phpbb plus, tambien se puede instalar en un foro que tenga
##	 instalado el Advance BBcode Box MOD
##
##      Example:
##  [youtube]YouTube URL[/youtube]
##
##  YouTube URL is the "Video URL (Permalink)" or the URL of the page the video 
##  is on, NOT the "Embeddable Player" code they have on their video pages.
## 
############################################################## 
#
#-----[ COPY ]-------------------------------------------
#

copy bbcode_box/images/youtube.gif to bbcode_box/images/youtube.gif 


#
#-----[ OPEN ]---------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);
#
#-----[ AFTER, ADD ]------------------------------------------
#

$bbcode_tpl['youtube'] = str_replace('{YOUTUBEID}', '\\1', $bbcode_tpl['youtube']);
$bbcode_tpl['youtube'] = str_replace('{YOUTUBELINK}', $lang['youtube_link'], $bbcode_tpl['youtube']);

#
#-----[ FIND ]------------------------------------------
#
$replacements[] = $bbcode_tpl['email'];
#
#-----[ AFTER, ADD ]------------------------------------------
#

// [youtube]YouTube URL[/youtube] code..
$patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
$replacements[] = $bbcode_tpl['youtube'];

#
#-----[ OPEN ]---------------------------------
#
bbcode_box/add_bbcode.js

#
#-----[ FIND ]------------------------------------------
#
imgr_help = "Right Image Tag [right]Image to align right[/right]";
#
#-----[ AFTER, ADD ]------------------------------------------
#

youtube_help = "Insert Youtube file: [youtube]Video URL[/youtube]";

#
#-----[ FIND ]------------------------------------------
#
var imgr = 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#

var youtube = 0;

#
#-----[ FIND ]------------------------------------------
#
function BBCimgr() {
	var FoundErrors = '';
	var enterURL   = prompt("Enter the image URL","http://");
	if (!enterURL) {
		FoundErrors += "You didn't write the image URL";
	}
	if (FoundErrors) {
		alert("Error :"+FoundErrors);
		return;
	}
	var ToAdd = "[right]"+enterURL+"[/right]";
	document.post.message.value+=ToAdd;
	document.post.message.focus();
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

function BBCyoutube() {
	var FoundErrors = '';
	var enterURL   = prompt("Enter the Youtube URL","http://");
	if (!enterURL) {
		FoundErrors += "You didn't write the Youtube URL";
	}
	if (FoundErrors) {
		alert("Error :"+FoundErrors);
		return;
	}
	var ToAdd = "[youtube]"+enterURL+"[/youtube]";
	document.post.message.value+=ToAdd;
	document.post.message.focus();
}


#
#-----[ OPEN ]---------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]---------------------------------
#
# NOTE: the full line to look for is:
#$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]";
#
$lang['bbcode_f_help'] =

#
#-----[ AFTER, ADD ]---------------------------------
#

$lang['youtube_link'] = 'Link';


#
#-----[ OPEN ]------------------------------------------ 
#
templates/fisubsilversh/bbcode.tpl
    
#
#-----[ FIND ]------------------------------------------ 
#
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</a><!-- END email -->
#
#-----[ AFTER, ADD ]------------------------------------------ 
#

<!-- BEGIN youtube -->
<object width="425" height="350">
	<param name="movie" value="http://www.youtube.com/v/{YOUTUBEID}"></param>
	<embed src="http://www.youtube.com/v/{YOUTUBEID}" type="application/x-shockwave-flash" width="425" height="350"></embed>
</object><br />
<a href="http://youtube.com/watch?v={YOUTUBEID}" target="_blank">{YOUTUBELINK}</a><br />
<!-- END youtube -->

#
#-----[ OPEN ]---------------------------------
#
templates/fisubsilversh/posting_body.tpl

#
#-----[ FIND ]---------------------------------
#
<img border="0" src="bbcode_box/images/ram.gif" width="24" height="20" name="ram" type="image" onClick="BBCram()" onMouseOver="helpline('ram')" style="border-style: outset; border-width: 1" alt="Real Media">
#
#-----[ IN-LINE FIND ]---------------------------------
#

<img border="0" src="bbcode_box/images/youtube.gif" width="24" height="20" name="youtube" type="image" onClick="BBCyoutube()" onMouseOver="helpline('youtube')" style="border-style: outset; border-width: 1" alt="Youtube">

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
#
# EoM
